package gameObject;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import content.ImagesConstants;
import data.Float2;

/**
 * 
 * @author Yvens
 * 
 */
public class Fighter {

	private int hp;
	private int mp;
	private int atack;
	private int defense;
	private int agility;
	private int intelect;
	private int lucky;
	private int fightId;
	private boolean ally;
	private boolean actAlready;
	private Float2 position;
	private BufferedImage img;
	private BufferedImage imgFace;
	private String key;
	private String name;
	private Skill[] skills;
	private BufferedImage[] standMoviment;

	/**
	 * @param hp
	 * @param mp
	 * @param atack
	 * @param defense
	 * @param agility
	 * @param intelect
	 * @param lucky
	 * @param name
	 */
	public Fighter(int hp, int mp, int atack, int defense, int agility, int intelect, int lucky, String name) {
		super();
		this.hp = hp;
		this.mp = mp;
		this.atack = atack;
		this.defense = defense;
		this.agility = agility;
		this.intelect = intelect;
		if(lucky < 0){
			this.lucky = 0;
		}else{
			this.lucky = lucky;			
		}
		this.name = name;
		try {
			img = ImageIO.read(new File(ImagesConstants.ENEMY_DEFAULT_FIGHT));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	

	/**
	 * 
	 * @param hp
	 * @param mp
	 * @param atack
	 * @param defense
	 * @param agility
	 * @param intelect
	 * @param lucky
	 * @param position
	 * @param ally
	 * @param name
	 */
	public Fighter(int hp, int mp, int atack, int defense, int agility, int intelect, int lucky, Float2 position, boolean ally, String name) {
		super();
		this.hp = hp;
		this.mp = mp;
		this.atack = atack;
		this.defense = defense;
		this.agility = agility;
		this.intelect = intelect;
		if(lucky < 0){
			this.lucky = 0;
		}else{
			this.lucky = lucky;			
		}
		this.position = position;
		this.ally = ally;
		this.name = name;
		try {
			img = ImageIO.read(new File(ImagesConstants.ENEMY_DEFAULT_FIGHT));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	/**
	 * 
	 */
	public Fighter() {
		super();
	}

	/**
	 * @return the hp
	 */
	public int getHp() {
		return hp;
	}

	/**
	 * @param hp the hp to set
	 */
	public void setHp(int hp) {
		this.hp = hp;
	}

	/**
	 * @return the mp
	 */
	public int getMp() {
		return mp;
	}

	/**
	 * @param mp the mp to set
	 */
	public void setMp(int mp) {
		this.mp = mp;
	}

	/**
	 * @return the atack
	 */
	public int getAtack() {
		return atack;
	}

	/**
	 * @param atack the atack to set
	 */
	public void setAtack(int atack) {
		this.atack = atack;
	}

	/**
	 * @return the defense
	 */
	public int getDefense() {
		return defense;
	}

	/**
	 * @param defense the defense to set
	 */
	public void setDefense(int defense) {
		this.defense = defense;
	}

	/**
	 * @return the agility
	 */
	public int getAgility() {
		return agility;
	}

	/**
	 * @param agility the agility to set
	 */
	public void setAgility(int agility) {
		this.agility = agility;
	}

	/**
	 * @return the intelect
	 */
	public int getIntelect() {
		return intelect;
	}

	/**
	 * @param intelect the intelect to set
	 */
	public void setIntelect(int intelect) {
		this.intelect = intelect;
	}

	/**
	 * @return the lucky
	 */
	public int getLucky() {
		return lucky;
	}

	/**
	 * @param lucky the lucky to set
	 */
	public void setLucky(int lucky) {
		this.lucky = lucky;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the position
	 */
	public Float2 getPosition() {
		return position;
	}

	/**
	 * @param position the position to set
	 */
	public void setPosition(Float2 position) {
		this.position = position;
	}

	/**
	 * @param x, y  the position to set
	 */
	public void setPosition(float x, float y){
		this.position = new Float2(x, y);
	}
	
	public String toString(){
		return "Nome: "+name+"\nHP: "+hp+" MP: "+mp+"" +
				"\nAtaque: "+atack+" Defesa: "+defense+" Agilidade: "+agility
				+" Intelecto: "+intelect+" Sorte: "+lucky;
	}

	/**
	 * @return the ally
	 */
	public boolean isAlly() {
		return ally;
	}

	/**
	 * @param ally the ally to set
	 */
	public void setAlly(boolean ally) {
		this.ally = ally;
	}

	/**
	 * @return the img
	 */
	public BufferedImage getImg() {
		return img;
	}


	/**
	 * @param img the img to set
	 */
	public void setImg(BufferedImage img) {
		this.img = img;
	}


	/**
	 * @return the skills
	 */
	public Skill[] getSkills() {
		return skills;
	}


	/**
	 * @param skills the skills to set
	 */
	public void setSkills(Skill[] skills) {
		this.skills = skills;
	}


	/**
	 * @return the key
	 */
	public String getKey() {
		return key;
	}

	/**
	 * @param key the key to set
	 */
	public void setKey(String key) {
		this.key = key;
	}


	/**
	 * @return the imgFace
	 */
	public BufferedImage getImgFace() {
		return imgFace;
	}


	/**
	 * @param imgFace the imgFace to set
	 */
	public void setImgFace(BufferedImage imgFace) {
		this.imgFace = imgFace;
	}

	/**
	 * @return the actAlready
	 */
	public boolean isActAlready() {
		return actAlready;
	}

	/**
	 * @param actAlready the actAlready to set
	 */
	public void setActAlready(boolean actAlready) {
		this.actAlready = actAlready;
	}

	/**
	 * @return the standMoviment
	 */
	public BufferedImage[] getStandMoviment() {
		return standMoviment;
	}

	/**
	 * @param standMoviment the standMoviment to set
	 */
	public void setStandMoviment(BufferedImage[] standMoviment) {
		this.standMoviment = standMoviment;
	}

	/**
	 * @return the fightId
	 */
	public int getFightId() {
		return fightId;
	}

	/**
	 * @param fightId the fightId to set
	 */
	public void setFightId(int fightId) {
		this.fightId = fightId;
	}

}
